//package com.fast.develop.configuration;
//
//import com.fast.develop.configuration.properties.FastDevelopPropesties;
//import com.fast.develop.core.enums.RequestMethod;
//import com.fast.develop.core.properties.DomainRuntimeProperties;
//import com.fast.develop.core.vo.PageReq;
//import com.fast.develop.core.web.AbstractMappingRegistor;
//import com.fast.develop.core.web.MappingInfo;
//import com.fast.develop.integration.web.DomainModelResourcesRest;
//import com.fast.develop.integration.web.MvcMappingHandlerMapping;
//import lombok.SneakyThrows;
//import org.springframework.beans.factory.InitializingBean;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
//
//import javax.servlet.http.HttpServletRequest;
//import java.util.Map;
//
//import static cn.hutool.core.util.URLUtil.getPath;
//
//
///**
// * magic-api自动配置类
// *
// * @author mxd
// */
//@Configuration
//@ConditionalOnClass({RequestMappingHandlerMapping.class})
//public class FastDevelopWebConfiguration implements WebMvcConfigurer, InitializingBean {
//
//	@Autowired
//	private FastDevelopPropesties fastDevelopPropesties;
//
//	@Autowired
//	private MvcMappingHandlerMapping mvcMappingHandlerMapping;
//
//
//	@Override
//	public void addResourceHandlers(ResourceHandlerRegistry registry) {
//		registry.addResourceHandler(fastDevelopPropesties.getEditorWebUrl() + "/**").addResourceLocations("classpath:/fast-develop-editor/");
//	}
//
//
//
//
//	private String redirectIndex(HttpServletRequest request) {
//		if (request.getRequestURI().endsWith("/")) {
//			return "redirect:./index.html";
//		}
//		return "redirect:" + fastDevelopPropesties.getEditorWebUrl() + "/index.html";
//	}
//
//	@SneakyThrows
//	private void registerEditorMapping(){
//		// 注册editor web mapping
//		MappingInfo mappingInfo = new MappingInfo(new String[]{fastDevelopPropesties.getEditorWebUrl()}, new RequestMethod[]{RequestMethod.GET});
//		mvcMappingHandlerMapping.registerMapping(mappingInfo, FastDevelopWebConfiguration.this, FastDevelopWebConfiguration.class.getDeclaredMethod("redirectIndex", HttpServletRequest.class));
//	}
//
//	@Override
//	public void afterPropertiesSet() throws Exception {
//		registerEditorMapping();
//	}
//}
